<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
		<link href="../css/sfmain.css" rel="stylesheet" type="text/css"></link>
		<script src="../js/jquery-1.11.3.min.js"></script>
		<script src="../js/common.js"></script>
<!--		<script src="../js/sqlite.js"></script>-->
<!--		<script src="../js/gjy.js"></script>-->
		<script>
		 $(function() {
			selectNewData();
		 });
		function saveInfo(){
            //createtable();
            var happentime = $("#happentime").val();//随访日期
            var visityType = $("input[name='sffs']:checked").val();//随访方式
            var sfbr = $("input[name='sfbr']:checked").val();//是否本人
            var tgrgx = $("#tgrgx").val();//提供信息者与被访人关系
 			var zz = "";//症状
				$('input:checkbox[name=zz]:checked').each(function (i) {
					if (0 == i) {
						zz = $(this).val();
					} else {
						zz += ("," + $(this).val());
					}
				});

            var zzqt = $("#zzqt").val();//症状其他
            var gjzz = $("input[name='gjzz']:checked").val();//关节肿胀
            var gjjx = $("input[name='gjjx']:checked").val();//关节畸形
            var gjyt = $("input[name='gjyt']:checked").val();//关节压痛
            var mcg = $("input[name='mcg']:checked").val();//摩擦感
            var weight = $("#weight").val();//体重
            var tzqt = $("#tzqt").val();//体征其他
            var kztz = $("#kztz").val();//控制体重
            var xz = $("#xz").val();//平路行走
            var qc = $("#qc").val();//骑车
            var yy = $("#yy").val();//游泳
            var xltz = $("input[name='xltz']:checked").val();//心里调整
            var fyycx = $("input[name='fyycx']:checked").val();//服药依从性
            var ywblfy = $("input[name='ywblfy']:checked").val();//药物不良反应
            var sffl = $("input[name='sffl']:checked").val();//此次随访分类
            var ywmc1 = $("#ywmc1").val();//药物名称1
            var mr1 = $("#mr1").val();//每日1
            var mc1 = $("#mc1").val();//每次1
            var ywmc2 = $("#ywmc2").val();//药物名称2
            var mr2 = $("#mr2").val();//每日2
            var mc2 = $("#mc2").val();//每次2
            var ywmc3 = $("#ywmc3").val();//药物名称3
            var mr3 = $("#mr3").val();//每日3
            var mc3 = $("#mc3").val();//每次3


            var sfys = $("#sfys").val();//随访医生
            var insertsql = "insert into gjy(id,personid,name,sex,happentime,visityType,sfbr,tgrgx,zz,zzqt,gjzz,gjjx,gjyt,mcg,weight,tzqt,kztz,xltz,xz,"
                             +"qc,yy,fyycx,ywblfy,sffl,ywmc1,mr1,mc1,ywmc2,mr2,mc2,ywmc3,mr3,mc3,sfys) values("
                            +"'"+Math.floor(Math.random()*10)+"',"
                            +"'"+personid+"',"
                            +"'"+name+"',"
                            +"'"+sex+"',"
                            +"'"+happentime+"',"
                            +"'"+visityType+"',"
                            +"'"+sfbr+"',"
                            +"'"+tgrgx+"',"
                            +"'"+zz+"',"
                            +"'"+zzqt+"',"
                            +"'"+gjzz+"',"
                            +"'"+gjjx+"',"
                            +"'"+gjyt+"',"
                            +"'"+mcg+"',"
                            +"'"+weight+"',"
                            +"'"+tzqt+"',"
                            +"'"+kztz+"',"
                            +"'"+xltz+"',"
                            +"'"+xz+"',"
                            +"'"+qc+"',"
                            +"'"+yy+"',"
                            +"'"+fyycx+"',"
                            +"'"+ywblfy+"',"
                            +"'"+sffl+"',"
                            +"'"+ywmc1+"',"
                            +"'"+mr1+"',"
                            +"'"+mc1+"',"
                            +"'"+ywmc2+"',"
                            +"'"+mr2+"',"
                            +"'"+mc2+"',"
                            +"'"+ywmc3+"',"
                            +"'"+mr3+"',"
                            +"'"+mc3+"',"
                            +"'"+sfys+"'"
                            +")";
            var jg = app.InsertSql(insertsql);
            if("success"==jg){
                alert("操作成功！");
            }
}

function selectNewData(){

	var selectsql = 'select * from gjy where personid='+personid+" order by happentime desc";
 	var data = app.getInfo3(selectsql);
    var obj = eval('(' + data + ')');
	if(null!=obj&&obj.length>0){
		var info = obj[0];
		$("#xm").html(info.name);
		$("#xb").html(info.sex);
		$("#happentime").val(info.happentime);//随访日期
		$("input[name='sffs'][value='"+info.visityType+"']").prop("checked",true);//随访方式
		$("input[name='sfbr'][value='"+info.sfbr+"']").prop("checked",true);//是否本人
		$("#tgrgx").val(info.tgrgx);//提供信息者与被访人关系
		var zz = info.zz;//症状
					if(null!=zz&&zz.length>0){
					$(zz.split(",")).each(function (i,e){
						$("input[name='zz'][value='"+e+"']").prop("checked",true);
					});
				}
		$("#zzqt").val(info.zzqt);//症状其他
		$("input[name='gjzz'][value='"+info.gjzz+"']").prop("checked",true);//关节肿胀
		$("input[name='gjjx'][value='"+info.gjjx+"']").prop("checked",true);//关节畸形
		$("input[name='lfsjj'][value='"+info.lfsjj+"']").prop("checked",true);//类风湿结节
		$("input[name='gjyt'][value='"+info.gjyt+"']").prop("checked",true);//关节压痛
		$("input[name='mcg'][value='"+info.mcg+"']").prop("checked",true);//摩擦感
		$("#weight").val(info.weight);//体重
		$("#tzqt").val(info.tzqt);//体征其他
		$("#kztz").val(info.kztz);//控制体重
		$("input[name='xltz'][value='"+info.xltz+"']").prop("checked",true);//心里调整
		$("#xz").val(info.xz);//平路行走
		$("#qc").val(info.qc);//骑车
		$("#yy").val(info.yy);//游泳
		$("input[name=fyycx]:eq("+info.fyycx+")").attr("checked",'checked');//服药依从性
		$("input[name=ywblfy]:eq("+info.ywblfy+")").attr("checked",'checked');//药物不良反应
		$("#ywmc1").val(info.ywmc1);//药物名称1
		$("#mr1").val(info.mr1);//每日1
		$("#mc1").val(info.mc1);//每次1
		$("#ywmc2").val(info.ywmc2);//药物名称2
		$("#mr2").val(info.mr2);//每日2
		$("#mc2").val(info.mc2);//每次2
		$("#ywmc3").val(info.ywmc3);//药物名称3
		$("#mr3").val(info.mr3);//每日3
		$("#mc3").val(info.mc3);//每次3
		$("input[name='sffl'][value='"+info.sffl+"']").prop("checked",true);//此次随访分类
		 $("#sfys option[value='"+info.sfys+"']").attr("selected","selected");//随访医生
	}
}
		</script>
	</head>
	<body>
		<div class="dh">
			<div class="dhleft">
				<span>骨关节炎随访记录表</span>
			</div>
			<div class="bc" onclick="saveInfo()">
				<img  class="bcimg" src="../img/icon-save.png"/>
				<span class="bcspan">保存</span>
			</div>
		</div>
		<div class="maindiv">
			<div class="sfxx">
				<span class="sfxxspan">随访信息</span>
			</div>
			<div>
				<hr class="titleline" />
			</div>
			<div class="titlaspan">
				<span>基本信息</span>
      </div>
      <div class="titlebody">
        <div>
            <span class="span1">姓名：</span>
            <span  id="xm" style="margin-left:5px;"></span>
            <span class="span1" style="margin-left: 100px;" >性别：</span>
            <span  id="xb" style="margin-left:5px;"></span>
        </div>
        <div>
          <span class="span1">随访日期：</span>
          <input class="timeinput" id="happentime" type="date"/>
          
        </div>
		<div>
		  <span class="span1" >随访方式：</span>
		  <input class="radio_type" type="radio" value="1" name="sffs" id="sffs1" checked="checked"/>
		  <label for="sffs1">门诊</label>
		  <input class="radio_type" type="radio" value="2" name="sffs" id="sffs2" /> 
		  <label for="sffs2">家庭</label>
		  <input class="radio_type" type="radio" value="3" name="sffs" id="sffs3" />
		  <label for="sffs2">通过电话或者手机短信（微信）联系患者本人或者家人</label><br>
            <input class="radio_type" type="radio" style="margin-left: 105px;" value="4" name="sffs" id="sffs4" />
		  <label for="sffs4">其他地方进行面对面教育</label>
		  <input class="radio_type" type="radio" value="5" name="sffs" id="sffs5" />
		  <label for="sffs5">其他</label>
		</div>
        <div>				
          <span class="span1">是否本人：</span>
          <input class="radio_type" type="radio" name="sfbr" value="0" id="sfbr1" checked="checked"/> 
          <label for="sfbr1">是</label>
          <input class="radio_type" type="radio" name="sfbr" value="1" id="sfbr2" /> 
          <label for="sfbr2">否</label>
          <span class="span1" style="width:auto;">提供信息者与被调查人直接的关系：</span>
          <input type="text" class="inputcss" id="tgrgx"/>
        </div>
       
      </div>
	  
		<div class="titlaspan">
		<span>目前症状</span>
      </div>

      <div class="titlebody">
        <div>
		  <input type="checkbox" class="inputbox" value="1" name="zz" id="zz1"/>
		  1无症状&nbsp;&nbsp;
         <input type="checkbox" class="inputbox" value="2" style="margin-left: 26px;padding-left:26px;" name="zz" id="zz2"/>
         2关节痛
		 <input type="checkbox" class="inputbox" value="3" style="margin-left: 30px;padding-left:30px;" name="zz" id="zz3"/>
		 3晨起僵硬
		 <input type="checkbox" class="inputbox" value="4" style="margin-left: 20px;padding-left:20px;" name="zz" id="zz4"/>
		 4黏着感
		 <input type="checkbox" class="inputbox" value="5" style="margin-left: 20px;padding-left:20px;" name="zz" id="zz5"/>
		 5下肢无力<br>
		 <input type="checkbox" class="inputbox" value="6" name="zz" id="zz6"/>
		 6活动受限
		 <input type="checkbox" class="inputbox" style="margin-left: 20px;padding-left:20px;" value="7" name="zz" id="zz7"/>
		 7关节挛曲
		 <input type="checkbox" class="inputbox" style="margin-left: 20px;padding-left:20px;" value="8" name="zz" id="zz8"/>
		 8四肢发麻
		 <input type="checkbox" class="inputbox" style="margin-left: 20px;padding-left:20px;" value="9" name="zz" id="zz9"/>
		 9其他
		 <input type="text" class="inputcss" id="zzqt" style="width: 200px;"/>
        </div>
       
      </div>
	  <div class="titlaspan">
	  		<span>体征</span>
	  </div>
	  <div class="titlebody">
		<div >
			<span class="span1">1关节肿胀：</span>
			<input class="radio_type" type="radio" value="0" name="gjzz" id="gjzz1"/>
			<label for="gjzz1">有</label>
			<input class="radio_type" type="radio" value="1" name="gjzz" id="gjzz2" /> 
			<label for="gjzz2">无</label>
			<span class="span2">2关节畸形：</span>
			<input class="radio_type" type="radio" value="0" name="gjjx" id="gjjx1"/>
			<label for="gjjx1">有</label>
			<input class="radio_type" type="radio" value="1" name="gjjx" id="gjjx2" /> 
			<label for="gjjx2">无</label>			
			<span class="span2">3压痛：</span>
			<input class="radio_type" type="radio" value="0" name="gjyt" id="gjyt1"/>
			<label for="gjyt1">有</label>
			<input class="radio_type" type="radio" value="1" name="gjyt" id="gjyt2" /> 
			<label for="gjyt2">无</label>
        </div>
          <div>
			<span class="span1">4摩擦感：</span>
			<input class="radio_type" type="radio" value="0" name="mcg" id="mcg1"/>
			<label for="mcg1">有</label>
			<input class="radio_type" type="radio" value="1" name="mcg" id="mcg2" /> 
			<label for="mcg2">无</label>
		</div>
		<div>
			<span class="span1">其他：</span>
			<input type="text" class="inputcss" id="tzqt" style="width: 200px;"/>
			<span class="span2">体重(kg)：</span>
	        <input type="number" class="inputcss" style="width: 60px;"  id="weight"/>
	    </div>
	  </div>
	  <div class="titlaspan">
	  	<span>生活方式指导</span>
	  </div>
	  <div class="titlebody">
		<div>
			<span class="span1">控制体重(kg)：&nbsp;&nbsp;</span>
			<input type="number" class="inputcss" style="width: 60px;"  id="kztz"/>
			<span class="span2">心理调整：</span>
			<input class="radio_type" type="radio" value="1" name="xltz" id="xltz1"  checked="checked"/>
			<label for="xltz1">良好</label>
			<input class="radio_type" type="radio" value="2" name="xltz" id="xltz2"/> 
			<label for="xltz2">一般</label>
			<input class="radio_type" type="radio" value="3" name="xltz" id="xltz3"/>
			<label for="xltz3">差</label>
		</div>
		<div>
			<span class="span2" style="width:auto">康复锻炼：平时行走</span>
			<input type="number" class="inputcss" style="width: 60px;"  id="xz"/><span class="dw">步/日</span>
			<span class="span2" style="width:auto">骑车</span>
			<input type="number" class="inputcss" style="width: 60px;"  id="qc"/><span class="dw">小时/日</span><br>
			<span class="span2" style="width:auto">游&nbsp;&nbsp;泳</span>&nbsp;
			<input type="number" class="inputcss" style="width: 60px;"  id="yy"/><span class="dw">小时/日</span>
		</div>
			 
	  </div>
	  <div class="titlaspan">
	  	<span>用药情况</span>
	  </div>
	  <div class="titlebody">
	  <div>
	    <span class="span1">药物名称1：</span>
	  		<input type="text" class="inputcss" id="ywmc1" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr1" style="width: 30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc1" style="width: 30px;"/>
	  </div>
	  <div>
	    <span class="span1">药物名称2：</span>
	  		<input type="text" class="inputcss" id="ywmc2" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr2" style="width: 30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc2" style="width: 30px;"/>
	  </div>
	  <div>
	    <span class="span1">药物名称3：</span>
	  		<input type="text" class="inputcss" id="ywmc3" style="width: 120px;"/>
	    <span class="span2">用法：每日：</span>
	    <input type="number" class="inputcss" id="mr3" style="width: 30px;"/><span class="dw">次</span>
	  		<span class="span2">每次：</span>
	  		<input type="number" class="inputcss" id="mc3" style="width: 30px;"/>
	  </div>
	  </div>
	  <div class="titlaspan">
	  	<span>服药依从性</span>
	  </div>
	  <div class="titlebody">
		  <input class="radio_type" type="radio" value="1" name="fyycx" id="fyycx1"/>
		  <label for="fyycx1">规律</label>
		  <input class="radio_type" type="radio" value="2" name="fyycx" id="fyycx2" /> 
		  <label for="fyycx2">间断</label>
		  	<input class="radio_type" type="radio" value="3" name="fyycx" id="fyycx3" />
		  	<label for="fyycx3">不服药</label>
	  </div>
	  <div class="titlaspan">
	  	<span>药物不良反应</span>
	  </div>
	  <div class="titlebody">
		  <input class="radio_type" type="radio" value="0" name="ywblfy" id="ywblfy1"/>
		  <label for="ywblfy1">有</label>
		  <input class="radio_type" type="radio" value="1" name="ywblfy" id="ywblfy2" />
		  <label for="ywblfy2">无</label>
	  </div>
	  <div class="titlaspan">
	  	<span>此次随访分类</span>
	  </div>
	  <div class="titlebody">
	  		  <div>
	  			  <input class="radio_type" type="radio" value="0" name="sffl" id="sffl1"/>
	  			  <label for="sffl1">1控制满意</label>
	  			  <input class="radio_type" type="radio" value="2" name="sffl" id="sffl2"/>
	  			  <label for="sffl2">2控制不满意</label>
	  			  <input class="radio_type" type="radio" value="3" name="sffl" id="sffl3"/>
	  			  <label for="sffl3">3不良反应</label>
	  			  <input class="radio_type" type="radio" value="4" name="sffl" id="sffl4"/>
	  			  <label for="sffl4">4并发症</label>
	  		  </div>
	  </div>
	  
	 
	  
	 
	  <div  class="titlebody">
	    <span class="span1">随访医生：</span>
          <select class="inputcss"   id="sfys">

          </select>
	  </div>
	 
	</div>
	</body>
</html>
